#  Copyright 2011 Nokia Siemens Networks Oyj
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

from __future__ import with_statement
import os

from ASN1Library.records import Records
from ASN1Library.asn1_structure import ASN1Factory


EXAMPLE_RECORD = '''
%% Generated by the Erlang ASN.1 compiler version:1.6.17
%% Purpose: Erlang record definitions for each named and unnamed
%% SEQUENCE and SET, and macro definitions for each value
%% definition,in module Example

-record('Fruit',{
name, color, price}).

-record('Person',{
name, sex, age = asn1_NOVALUE, hair}).
'''
RESOURCE_PATH = os.path.dirname(__file__)
S1AP_HRL_FILE = os.path.join(RESOURCE_PATH, '..', '..', 'ebin', 'S1AP.hrl')


def get_example_records():
    return Records(EXAMPLE_RECORD)

def get_S1AP_records():
    with open(S1AP_HRL_FILE, 'r') as in_file:
        input =  in_file.read()
    return Records(input)

def get_example_ASN1Factory():
    return ASN1Factory(get_example_records())